import type { IFormData } from "./types";

export class UserFormData implements IFormData {
  username: string = "";
  avatar: string = "";
  email: string = "";
  phone: string = "";
  role: string = "user";
  status: string = "active"; // active, inactive, deleted
  constructor(data?: Partial<UserFormData>) {
    this.reset();
    if (data) Object.assign(this, data);
  }

  reset(): void {
    Object.assign(this, {
      username: "",
      avatar: "",
      email: "",
      role: "user",
      phone: "",
      status: "", // active, inactive, deleted
    });
  }

  toSubmitData() {
    return {
      username: this.username,
      avatar: this.avatar,
      email: this.email,
      role: this.role,
      phone: this.phone,
      status: this.status,
    };
  }
}
